repo.or.cz
/
andmenj-acm.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Namespacing everything to /UVa.
[andmenj-acm.git]
/
UVa
/
11436 - Cubes EXTREME!
/
j.cpp
blob
59dfe0bd542bf4bb942bbde035c12c5ae7450268
1
#include<iostream>
2
#include<math.h>
3
using namespace
std
;
4
5
typedef
unsigned long long
ull
;
6
7
ull
cubo
(
ull x
){
8
ull i
=
1
;
9
while
(
i
*
i
*
i
<=
x
){
10
++
i
;
11
}
12
--
i
;
13
// cout << i << endl;
14
if
(
i
*
i
*
i
==
x
){
15
return
i
;
16
}
else
{
17
return
INT_MAX
;
18
}
19
}
20
21
int
main
(){
22
ull n
;
23
while
(
cin
>>
n
&&
n
){
24
ull y
=
1
;
25
bool
encontre
=
false
;
26
while
(
true
){
27
ull r
=
cubo
(
n
+ (
y
*
y
*
y
));
28
// cout << "r es: " << r << " y es: " << y << endl;
29
if
(
r
!=
INT_MAX
){
30
cout
<<
r
<<
" "
<<
y
<<
endl
;
31
encontre
=
true
;
32
break
;
33
}
34
++
y
;
35
if
((
y
+
1
)*(
y
+
1
)*(
y
+
1
) -
y
*
y
*
y
>
n
)
break
;
36
}
37
if
(!
encontre
){
38
cout
<<
"No solution
\n
"
;
39
continue
;
40
}
41
}
42
}